﻿using System;
using System.Collections.Generic;
using GameLogic.Statistics;

namespace GameLogic.Poker
{
    public class PokerPlayer:IPokerPlayer 
    {
        private List<Card> cards;
        public List<Card> Cards
        {
            get { return cards; }
            set 
            { 
                cards = value;
                currentCard = 0;
            }
        }

        public List<BattlesHistory> PlayerHistory;
        public BattlesHistory RoundHistory;

        public Currency Money = new Currency();
        private int currentCard;
        public User User;//= new User();
        public Currency Bet;

        //Use your own player class!!!

        
        public PokerPlayer()
        {
            Cards=new List<Card>();
            PlayerHistory = new List<BattlesHistory>();
            RoundHistory = new BattlesHistory();
            InitVars();
        }
        public PokerPlayer(List<Card> cards)
        {
            this.Cards = cards;
            PlayerHistory = new List<BattlesHistory>();
            RoundHistory = new BattlesHistory();
            InitVars();
        }
        //todo: сделайте разделение на стол и игроков за столом при инициализации.
        //у стола изначально должно быть 0, а у игроков деньги User'а
        private void InitVars()
        {
            Money=new Currency(1000,0);
            User=new User();
            Bet=new Currency(0,0);
        }
        public void ShowAllCards()
        {
            foreach (var card in cards)
            {
                card.State=State.Up;
            }
        }
        public void ShowNextCard()
        {
            if(currentCard>=cards.Count)
                throw new Exception("All cards opened!");
            cards[currentCard++].State=State.Up;
        }
    }
}